Skip to content

Conversation

bogdan-st
Copy link
Contributor

Adds initial draft for the User Overrides API, described in https://cortexmetrics.io/docs/proposals/overrides-api/

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@bogdan-st bogdan-st force-pushed the overrides_api branch 2 times, most recently from 29f5299 to 1dbe402 Compare August 15, 2025 18:55
Signed-off-by: Bogdan Stancu <[email protected]>
@bogdan-st bogdan-st changed the title Overrides API initial draft Add Overrides API component and rename old overrides to overrides-configs Aug 17, 2025
Copy link
Member

@friedrichg friedrichg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am liking it. I have do have a couple of suggestions

Signed-off-by: Bogdan Stancu <[email protected]>
@bogdan-st bogdan-st force-pushed the overrides_api branch 2 times, most recently from 90512a2 to 608f1ab Compare August 20, 2025 16:01
Signed-off-by: Bogdan Stancu <[email protected]>
Copy link
Member

@friedrichg friedrichg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it another pass. Thanks for your hard work!

@@ -411,6 +411,296 @@ query_scheduler:
# CLI flag: -query-scheduler.grpc-client-config.connect-timeout
[connect_timeout: <duration> | default = 5s]

overrides:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You added a new target "overrides", that's good. No need to add new flags. Use the flags available: https://cortexmetrics.io/docs/configuration/configuration-file/#runtime_configuration_storage_config

Comment on lines +60 to +62
if c.Backend == bucket.Filesystem {
return errors.New(ErrFilesystemBackendNotSupported)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filesystem is supported by the runtime configuration overrides. The API should support it. Remove this.

)

// Config holds configuration for the overrides module
type Config struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this config. Use

type Config struct {

@@ -126,6 +127,7 @@ type Config struct {
RuntimeConfig runtimeconfig.Config `yaml:"runtime_config"`
MemberlistKV memberlist.KVConfig `yaml:"memberlist"`
QueryScheduler scheduler.Config `yaml:"query_scheduler"`
Overrides overrides.Config `yaml:"overrides"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Overrides overrides.Config `yaml:"overrides"`

@@ -175,6 +177,7 @@ func (c *Config) RegisterFlags(f *flag.FlagSet) {
c.RuntimeConfig.RegisterFlags(f)
c.MemberlistKV.RegisterFlags(f)
c.QueryScheduler.RegisterFlags(f)
c.Overrides.RegisterFlags(f)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
c.Overrides.RegisterFlags(f)

@@ -66,6 +66,9 @@ For the sake of clarity, in this document we have grouped API endpoints by servi
| [Delete Alertmanager configuration](#delete-alertmanager-configuration) | Alertmanager || `DELETE /api/v1/alerts` |
| [Tenant delete request](#tenant-delete-request) | Purger || `POST /purger/delete_tenant` |
| [Tenant delete status](#tenant-delete-status) | Purger || `GET /purger/delete_tenant_status` |
| [Get user overrides](#get-user-overrides) | Overrides || `GET /api/v1/user-overrides` |
| [Set user overrides](#set-user-overrides) | Overrides || `PUT /api/v1/user-overrides` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| [Set user overrides](#set-user-overrides) | Overrides || `PUT /api/v1/user-overrides` |
| [Set user overrides](#set-user-overrides) | Overrides || `POST /api/v1/user-overrides` |

Comment on lines +30 to +33
type RuntimeConfigFile struct {
Overrides map[string]map[string]interface{} `yaml:"overrides"`
HardOverrides map[string]map[string]interface{} `yaml:"hard_overrides"`
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type RuntimeConfigFile struct {
Overrides map[string]map[string]interface{} `yaml:"overrides"`
HardOverrides map[string]map[string]interface{} `yaml:"hard_overrides"`
}

This overrides the other values saved in the runtime like ingester_limits

Use

type RuntimeConfigValues struct {
instead

And make sure the API doesn't delete ingester_limits values and similar

Comment on lines +18 to +25
var AllowedLimits = []string{
"max_global_series_per_user",
"max_global_series_per_metric",
"ingestion_rate",
"ingestion_burst_size",
"ruler_max_rules_per_rule_group",
"ruler_max_rule_groups_per_tenant",
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

// RegisterFlags registers the overrides module flags
func (c *Config) RegisterFlags(f *flag.FlagSet) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

}

// Validate validates the configuration and returns an error if validation fails
func (c *Config) Validate() error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this

@friedrichg
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants